<!DOCTYPE html>
<html lang="zh-CN">

<head>
  <meta charset="utf-8" />
  <meta http-equiv="X-UA-Compatible" content="IE=edge" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0" />
  <link rel="icon" href="/favicon.ico" />
  <title>Loading...</title>
</head>

<body>
<div id="app"></div>
<script type="module" src="/src/main.ts"></script>

</body>

</html>
<script>
  // 全局处理passive事件
  document.addEventListener('DOMContentLoaded', function() {
    // 添加passive事件支持
    const events = ['touchstart', 'touchmove', 'wheel', 'mousewheel'];
    events.forEach(function(event) {
      window.addEventListener(event, function() {
      }, {
        capture: true,
        passive: true,
      });
    });

    // 修改EventTarget原型，使所有滚动相关事件默认为passive
    const originalAddEventListener = EventTarget.prototype.addEventListener;
    EventTarget.prototype.addEventListener = function(type, listener, options) {
      if (events.includes(type)) {
        if (typeof options === 'object') {
          options.passive = true;
        } else {
          options = {
            passive: true,
            capture: options === true,
          };
        }
      }
      return originalAddEventListener.call(this, type, listener, options);
    };
  });
</script>
